package com.sinosoft.cloud.access.handler;

import com.sinosoft.cloud.access.net.MessageObject;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.ReferenceCountUtil;

/**
 * cloud-netty
 *
 * @title: cloud-netty
 * @package: com.sinosoft.cloud.access.net
 * @author: yangming
 * @date: 2017/12/6 下午1:56
 */
public abstract class AbstractRouterHandler extends AbstractHandler {

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        try {
            logger.info("进入:" + getClass().getSimpleName());
            if (msg instanceof MessageObject) {
                MessageObject in = (MessageObject) msg;
                MessageObject out = dealMessage(ctx, in);
            }
        } finally {
            ReferenceCountUtil.release(msg);
        }
    }
}
